import React, { useEffect, useState } from "react";
import axios from "axios";
import { Button, Space, Table, Tag } from "antd";
function Index() {
  const [data, setdata] = useState([]);
  const getData = () => {
    axios.get("/api/article/list").then((res) => {
      console.log(res);
      setdata(res.data.rows);
    });
  };
  useEffect(() => {
    getData();
  }, []);
  const columns = [
    {
      title: "ID",
      dataIndex: "id",
      key: "id",
      render: (text) => <a>{text}</a>,
    },

    {
      title: "Action",
      key: "action",
      render: (_, record) => (
        <Space size="middle">
          <Button>删除</Button>
          <Button>编辑</Button>
        </Space>
      ),
    },
  ];
  return (
    <div>
      <Table columns={columns} dataSource={data} />
    </div>
  );
}

export default Index;
